﻿@model List<FCTC_Web.Models.TeamMember>
<style type="text/css">
    #memberul li
    {
        float: left;
        margin-right: 10px;
        border: 2px;
    }
</style>
<script type="text/javascript">
    $(document).ready(function () {

        var teamid = $('#ID').val();
       
        $(":button").click(function () {
            $this = $(this);
            var memberid = $this.attr('modelid');
            var value = $this.val();

            if (value == "添加队员") {
                $.ajax({
                    url: "/Team/MemberCreate",
                    datatype: "html",
                    type: 'GET',
                    traditional: true,
                    success: function (result) {
                        $('#memberlist').html(result);
                    }
                });
            }

            if (value == "编辑") {
                $.ajax({
                    url: "/Team/MemberUpdate",
                    datatype: "html",
                    type: 'GET',
                    traditional: true,
                    data:
                          {
                              'teamid': teamid,
                              'memberid': memberid
                          },
                    success: function (result) {
                        $('#memberlist').html(result);
                    }
                });
            }

            if (value == "删除") {
                $.ajax({
                    url: "/Team/MemberDelete",
                    datatype: "html",
                    type: 'Post',
                    traditional: true,
                    data:
                          {
                              'teamid': teamid,
                              'memberid': memberid
                          },
                    success: function (result) {
                        $('#memberlist').html(result);
                    }
                });
            }
        });
    });
</script>
<p>
    @if (Model!=null && Model.Count < 10)
    {
        <input type="button" id="addMember" value="添加队员" />
    }
</p>
<ul id="memberul">
    @if (Model != null)
    {
        for (int i = 0; i < 10 && i < Model.Count; i++)
        {
        <li>
            <div>
                <img style="float: left" src="/images/moren_person.jpg" alt="moren" />
                <div>
                    <span>姓名：@Model[i].MemberFullName</span>
                    <br />
                    <span>性别：@Model[i].Gender</span>
                    <br />
                    <span>参赛状态：@Model[i].MemberStatus</span>
                </div>
                <div>
                    <br />
                    <span>身份证号：</span> <span>@Model[i].Identity</span>
                    <center>
                        <input type="button" value="编辑" modelid="@Model[i].ID" />
                        <input type="button" value="删除" modelid="@Model[i].ID"/></center>
                </div>
            </div>
        </li> 
        }
    }
</ul>
